# 帧：连续

import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((500,500))
pygame.display.set_caption("动画实现")
screen.fill((255,255,255))

m1 = pygame.image.load("./image/m1.png")
m2 = pygame.image.load("./image/m2.png")

screen.blit(m1,(0,0))

x=0
count = 1
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            exit()
        if event.type == KEYDOWN:
            if event.key == K_RIGHT:
                # 来回切换
                if count%2==0: # 第二次 m1 第四次 m1
                    x+=8
                    screen.blit(m1,(x,0))
                else:  # 第一次 m2 第三次 m2
                    x+=8
                    screen.blit(m2,(x,0))
                count+=1

    pygame.display.update()

